<template>
	<view>
		<view class="list" v-for="(item,index) in list" :key="index" @click="gonesdetails(item.id)">
			<view class="top-box">
				<view class="title">
					{{item.title}}
				</view>
				<view class="image">
					<image :src="item.images[0]" mode=""></image>
					<view class="Mask" v-if="item.videoUrl!==''">
						<image src="../static/video.png" mode=""></image>
					</view>
				</view>
			</view>
			<view class="data">
				<view class="time">
					{{item.time}}
				</view>
				<view class="box">
					<view class="mu">
						<view class="icon">
							<image src="/static/mu.png"></image>
						</view>
						<view class="text">
							{{item.showNum|| '0'}}
						</view>
					</view>
					<view class="info">
						<view class="icon">
							<image src="/static/news/info.png"></image>
						</view>
						<view class="text">
							{{item.commentNum|| '0'}}
						</view>
					</view>
					<view class="xin">
						<view class="icon">
							<image src="/static/news/xin.png"></image>
						</view>
						<view class="text">
							{{item.likeNum|| '0'}}
						</view>
					</view>
				</view>
			</view>
		</view>
		<view v-show="list.length > 0" style="padding-bottom: 20rpx;">
			<u-loadmore :status="status" :nomore-text="nomoreText" fontSize="12" color="#999" />
		</view>
	</view>
</template>

<script>
	export default {
		name: "newslist",
		data() {
			return {
				status: 'nomore',
				nomoreText: 'The End',
			};
		},
		props: {
			list: {
				type: Array,
				default () {
					return []
				}
			},
		},
		created() {
			console.log(this.list)
			if (this._i18n.locale == 'zh') {
				this.nomoreText = '没有更多了'
				this.cancelText = '取消'
			} else {
				this.nomoreText = 'The End'
				this.cancelText = 'Cancel'
			}
		},
		methods:{
			gonesdetails(id){
				console.log(id)
				uni.navigateTo({
					url:'/pages/news/newsdetails/index?id='+id
				})
			}
		}
	}
</script>

<style lang="less">
	.list {
		margin: 20rpx;
		padding: 20rpx;
		background-color: #ffffff;
		border-radius: 20rpx;

		.data {
			display: flex;
			justify-content: space-between;

			.time {
				font-size: 24rpx;
				color: #999;
			}

			.box {
				width: 45%;
				display: flex;
				justify-content: space-between;
				margin-left: 10rpx;

				.mu {
					display: flex;
					align-items: center;

					.icon {
						width: 26rpx;

						image {
							width: 26rpx;
							height: 24rpx;
						}
					}

					.text {
						font-size: 24rpx;
						color: #999;
						overflow: hidden;
						white-space: nowrap;
						text-overflow: ellipsis;
						-o-text-overflow: ellipsis;
						margin-left: 10rpx;
					}
				}

				.info {
					display: flex;
					align-items: center;

					.icon {
						width: 18rpx;

						image {
							width: 24rpx;
							height: 24rpx;
						}
					}

					.text {
						font-size: 24rpx;
						color: #999;
						overflow: hidden;
						white-space: nowrap;
						text-overflow: ellipsis;
						-o-text-overflow: ellipsis;
						margin-left: 10rpx;
					}
				}

				.xin {
					display: flex;
					align-items: center;

					.icon {
						width: 18rpx;

						image {
							width: 24rpx;
							height: 24rpx;
						}
					}

					.text {
						font-size: 24rpx;
						color: #999;
						overflow: hidden;
						white-space: nowrap;
						text-overflow: ellipsis;
						-o-text-overflow: ellipsis;
						margin-left: 10rpx;
					}
				}
			}
		}

		.top-box {
			display: flex;
			justify-content: space-between;

			.image {
				position: relative;

				.Mask {
					position: absolute;
					width: 100%;
					height: 180rpx;
					border-radius: 10rpx;
					background-color: rgba(0, 0, 0, 0.3);
					top: 0;
					text-align: center;
					line-height: 180rpx;

					image {
						width: 30rpx;
						height: 30rpx;
					}
				}

				image {
					width: 230rpx;
					height: 180rpx;
					border-radius: 20rpx;
				}
			}
		}
	}
</style>
